Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Tests #114

Merged
merged 9 commits into from
Dec 8, 2020
Merged

Improve Tests #114

merged 9 commits into from
Dec 8, 2020

Conversation

AustinSeto
Copy link
Contributor

@AustinSeto AustinSeto commented Jun 25, 2020

Addresses #64
Restores changes from #91

@AustinSeto AustinSeto linked an issue Jun 25, 2020 that may be closed by this pull request
@AustinSeto AustinSeto linked an issue Jul 8, 2020 that may be closed by this pull request
@TiagoF99
Copy link

Code looks good. Will verify the code now.

Copy link

@TiagoF99 TiagoF99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified. Everything seems to be working properly

Copy link
Member

@gkwan-ibm gkwan-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AustinSeto

  public void testInventoryAccessCountMetric() {
    metrics = getMetrics();
    int accessCountBefore = getIntMetric(metrics,
                                         "application_inventoryAccessCount_total");
    int accessCountAfter = 0;
    connectToEndpoint(baseHttpUrl + INVENTORY_HOSTS);
    metrics = getMetrics();
    accessCountAfter = getIntMetric(metrics,
                                    "application_inventoryAccessCount_total");
    assertTrue(accessCountAfter > accessCountBefore);
  }

to

  public void testInventoryAccessCountMetric() {
    metrics = getMetrics();
    int accessCountBefore = getIntMetric(metrics,
                                         "application_inventoryAccessCount_total");
    connectToEndpoint(baseHttpUrl + INVENTORY_HOSTS);
    metrics = getMetrics();
    int accessCountAfter = getIntMetric(metrics,
                                    "application_inventoryAccessCount_total");
    assertTrue(accessCountAfter > accessCountBefore);
  }

@gkwan-ibm
Copy link
Member

@AustinSeto The logic was changed for your new implementation. The existing way checks all metrics startedWith a string, but your getIntMetric() just check the last metric startedWith the string. Need to confirm how many metrics are returned startedWith the string and apply the proper test logic.

@AustinSeto
Copy link
Contributor Author

@gkwan-ibm updated test implementation to use map to store all found metrics and compare all of them.

@gkwan-ibm
Copy link
Member

hi @Charlotte-Holt would you review the README.adoc?

Copy link

@Charlotte-Holt Charlotte-Holt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AustinSeto Just a few ID review comments. Let me know if you have questions!

README.adoc Outdated
`\http://localhost:9080/inventory/systems` URL to retrieve the whole inventory, and then it asserts
that this endpoint is accessed at least once.
* The [hotspot=testInventoryAccessCountMetric file=0]`testInventoryAccessCountMetric()` test case validates the [hotspot=countedForList file=1]`@Counted` metric.
The test case obtains the metric before and after a request to the `\http://localhost:9080/inventory/systems` URL.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested update

The test case obtains metric data before and after a request to the \http://localhost:9080/inventory/systems URL.

README.adoc Outdated
that this endpoint is accessed at least once.
* The [hotspot=testInventoryAccessCountMetric file=0]`testInventoryAccessCountMetric()` test case validates the [hotspot=countedForList file=1]`@Counted` metric.
The test case obtains the metric before and after a request to the `\http://localhost:9080/inventory/systems` URL.
It asserts that the metric was increased after the access.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this one, I'm thinking update it to

It then asserts that the metric was increased after the URL was accessed.

If that makes sense to you? I had a harder time understanding exactly what this sentence meant.

@AustinSeto
Copy link
Contributor Author

@Charlotte-Holt I made both suggested changes, let me know if there's any other comments.

@gkwan-ibm gkwan-ibm merged commit e9073ab into qa Dec 8, 2020
@AustinSeto AustinSeto deleted the improve-test-coverage branch December 8, 2020 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The escape char is not showing up on the UI Improve test coverage?
4 participants